package com.lid.lib;

import ohos.agp.components.AttrSet;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.render.Canvas;
import ohos.agp.utils.Color;
import ohos.app.Context;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

/**
 * LabelButtonView;
 *
 * @since 2021-04-13
 */
public class LabelButtonView extends Button implements Component.DrawTask {
    private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "LabelButtonView");
    LabelViewHelper utils;

    /**
     * LabelButtonView
     *
     * @param context
     */
    public LabelButtonView(Context context) {
        super(context);
    }

    /**
     * LabelButtonView
     *
     * @param context
     * @param attrs
     */
    public LabelButtonView(Context context, AttrSet attrs) {
        this(context, attrs, "");
    }

    /**
     * LabelButtonView
     *
     * @param context
     * @param attrs
     * @param defStyleAttr
     */
    public LabelButtonView(Context context, AttrSet attrs, String defStyleAttr) {
        super(context, attrs, defStyleAttr);
        utils = new LabelViewHelper(context, attrs, defStyleAttr);
        addDrawTask(this);
    }

    @Override
    public void onDraw(Component component, Canvas canvas) {
        utils.onDraw(canvas, getWidth() - getPaddingLeft() - getPaddingRight(),
                getHeight() - getPaddingTop() - getPaddingBottom());
    }

    /**
     * setLabelHeight
     *
     * @param height
     */
    public void setLabelHeight(int height) {
        utils.setLabelHeight(this, height);
    }

    public int getLabelHeight() {
        return utils.getLabelHeight();
    }

    /**
     * setLabelDistance
     *
     * @param distance
     */
    public void setLabelDistance(int distance) {
        utils.setLabelDistance(this, distance);
    }

    public int getLabelDistance() {
        return utils.getLabelDistance();
    }

    public boolean isLabelVisual() {
        return utils.isLabelVisual();
    }

    /**
     * setLabelVisual
     *
     * @param isEnable
     */
    public void setLabelVisual(boolean isEnable) {
        utils.setLabelVisual(this, isEnable);
    }

    public int getLabelOrientation() {
        return utils.getLabelOrientation();
    }

    /**
     * setLabelOrientation
     *
     * @param orientation
     */
    public void setLabelOrientation(int orientation) {
        utils.setLabelOrientation(this, orientation);
    }

    public Color getLabelTextColor() {
        return utils.getLabelTextColor();
    }

    /**
     * setLabelTextColor
     *
     * @param textColor
     */
    public void setLabelTextColor(Color textColor) {
        utils.setLabelTextColor(this, textColor);
    }

    public Color getLabelBackgroundColor() {
        return utils.getLabelBackgroundColor();
    }

    /**
     * setLabelBackgroundColor
     *
     * @param backgroundColor
     */
    public void setLabelBackgroundColor(Color backgroundColor) {
        utils.setLabelBackgroundColor(this, backgroundColor);
    }

    public String getLabelText() {
        return utils.getLabelText();
    }

    /**
     * setLabelText
     *
     * @param text
     */
    public void setLabelText(String text) {
        utils.setLabelText(this, text);
    }

    public int getLabelTextSize() {
        return utils.getLabelTextSize();
    }

    /**
     * setLabelTextSize
     *
     * @param textSize
     */
    public void setLabelTextSize(int textSize) {
        utils.setLabelTextSize(this, textSize);
    }

    public int getLabelTextStyle() {
        return utils.getLabelTextStyle();
    }

    /**
     * setLabelTextStyle
     *
     * @param textStyle
     */
    public void setLabelTextStyle(int textStyle) {
        utils.setLabelTextStyle(this, textStyle);
    }
}
